home *** CD-ROM | disk | FTP | other *** search
- #ifndef __STD_MESSAGE__
- #define __STD_MESSAGE__
- #pragma option push -b -a4 -Vx- -Ve- -w-inl -w-aus -w-sig
-
- /***************************************************************************
- *
- * messages - Declarations for the Standard Library messaging facet
- *
- *
- ***************************************************************************
- *
- * (c) Copyright 1994, 1995 Rogue Wave Software, Inc.
- * ALL RIGHTS RESERVED *
- * The software and information contained herein are proprietary to, and
- * comprise valuable trade secrets of, Rogue Wave Software, Inc., which
- * intends to preserve as trade secrets such software and information.
- * This software is furnished pursuant to a written license agreement and
- * may be used, copied, transmitted, and stored only in accordance with
- * the terms of such license and with the inclusion of the above copyright
- * notice. This software and information or any other copies thereof may
- * not be provided or otherwise made available to any other person.
- *
- * Notwithstanding any other lease or license that may pertain to, or
- * accompany the delivery of, this computer software and information, the
- * rights of the Government regarding its use, reproduction and disclosure
- * are as set forth in Section 52.227-19 of the FARS Computer
- * Software-Restricted Rights clause.
- *
- * Use, duplication, or disclosure by the Government is subject to
- * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
- * Technical Data and Computer Software clause at DFARS 252.227-7013.
- * Contractor/Manufacturer is Rogue Wave Software, Inc.,
- * P.O. Box 2328, Corvallis, Oregon 97339.
- *
- * This computer software and information is distributed with "restricted
- * rights." Use, duplication or disclosure is subject to restrictions as
- * set forth in NASA FAR SUP 18-52.227-79 (April 1985) "Commercial
- * Computer Software-Restricted Rights (April 1985)." If the Clause at
- * 18-52.227-74 "Rights in Data General" is specified in the contract,
- * then the "Alternate III" clause applies.
- *
- **************************************************************************/
-
-
- #ifndef __STD_RWLOCALE__
- #include "rw/rwlocale.h"
- #endif
-
- #ifndef _RWSTD_NO_NAMESPACE
- namespace std {
- #endif
-
- struct _RWSTDExport messages_base {
- typedef int catalog;
- };
-
- #ifndef _RWSTD_NO_NAMESPACE
- } namespace __rwstd {
- #endif
-
- // --------------------------------------
- // Implementation class -- messages_impl.
- // --------------------------------------
-
- class _RWSTDExport messages_impl {
- string loc_name_; \
- protected:
- messages_impl (string name);
-
- messages_base::catalog open_cat_ (const string &,const locale &) const;
- char *get_mess_ (messages_base::catalog,int,int) const;
- const locale &get_loc_ (messages_base::catalog) const;
- void close_cat_ (messages_base::catalog) const;
- static string get_loc_name_ (const char*);
- };
-
- #ifndef _RWSTD_NO_NAMESPACE
- } namespace std {
- #endif
-
- // ----------------------------------------------------
- // Standard message retrieval facet -- messages<charT>.
- // ----------------------------------------------------
-
- template <class charT>
- class messages: public locale::facet, public messages_base,
- public __RWSTD::messages_impl
- {
- public:
- typedef charT char_type;
- typedef basic_string<charT,char_traits<charT>,allocator<charT> > string_type;
-
- _EXPLICIT messages (size_t refs=0);
-
- catalog open (const string& fn, const locale& loc) const
- { return do_open(fn,loc); }
- string_type get (catalog c, int set, int msgid, const string_type& df) const
- { return do_get(c,set,msgid,df); }
- void close (catalog c) const { do_close(c); }
-
- static locale::id id;
-
- // Implementation:
- enum { facet_cat_ = locale::messages, ok_implicit_ = 1 };
-
- protected:
- virtual ~messages();
-
- virtual catalog do_open (const string&, const locale&) const;
- virtual string_type do_get (catalog, int, int, const string_type&) const;
- virtual void do_close (catalog) const;
-
- // Implementation:
- messages (size_t refs,string);
-
- private:
- #ifdef _RWSTD_NO_MEMBER_TEMPLATES
- locale::id &get_id (void) const { return id; }
- #endif
- };
-
- // -------------------------------------------------
- // Standard derived facet -- messages_byname<charT>.
- // -------------------------------------------------
-
- template <class charT>
- class _RWSTDExportTemplate messages_byname: public messages<charT> {
- public:
- _EXPLICIT messages_byname (const char*, size_t refs=0);
-
- protected:
-
- // Virtual members inherited from messages<charT>:
- // ~messages_byname();
- // catalog do_open (const string&, const locale&) const;
- // string_type do_get (catalog, int, int, const string_type&) const;
- // void do_close (catalog) const;
- };
-
- #ifndef _RWSTD_NO_NAMESPACE
- } namespace __rwstd {
- #endif
-
- #ifndef _RWSTD_NO_FUNC_PARTIAL_SPEC
-
- template <class charT>
- inline messages<charT>* _RWSTDExport create_named_facet
- (messages<charT>*,const char *name,size_t refs)
- { return new messages_byname<charT>(name,refs); }
-
- #else
- _RWSTD_TEMPLATE
- inline _STD::messages<char>* _RWSTDExport create_named_facet
- (_STD::messages<char>*,const char *name,size_t refs)
- { return new messages_byname<char>(name,refs); }
-
- #ifndef _RWSTD_NO_WIDE_CHAR
- _RWSTD_TEMPLATE
- inline _STD::messages<wchar_t>* _RWSTDExport create_named_facet
- (_STD::messages<wchar_t>*,const char *name,size_t refs)
- { return new messages_byname<wchar_t>(name,refs); }
-
- #endif // _RWSTD_NO_WIDE_CHAR
- #endif // _RWSTD_NO_FUNC_PARTIAL_SPEC
-
-
- #ifndef _RWSTD_NO_NAMESPACE
- } // namespace __rwstd
- #endif
-
- #ifdef _RWSTD_COMPILE_INSTANTIATE
- #include <rw/messages.cc>
- #endif
-
- #pragma option pop
- #endif /* __STD_MESSAGE__ */
-